<div class="page" style="min-height: 500px;">
  <div class="page-container">
    <div class="container">
      <div class="row">
        <div class="span12">
          <div class="btn-group pull-right">
			<?php if ($this->is_admin) { ?>
  			<a class="btn" title="Update all users point" href="<?php echo base_url('users/update_all_points'); ?>"><i class="icon-refresh"></i>&nbsp;<b>Update All Users Point</b></a>
			<?php } else { ?>
  			<a class="btn" title="Update my point" href="<?php echo base_url('users/update_my_points'); ?>"><i class="icon-refresh"></i>&nbsp;<b>Update My Point</b></a>
			<?php } ?>
            <a class="btn dropdown-toggle" data-toggle="dropdown"><i class="icon-info-sign"></i>&nbsp;<b>Points</b></a>
            <ul class="dropdown-menu ">
              <li><a>Post reply / comment : <b>1 point</b></a></li>
              <li><a>Post tweet / poll / album : <b>2 points</b></a></li>
              <li><a>Gain like for poll / album / photo : <b>5 points</b></a></li>
              <li><a>Gain like for reply / comment : <b>10 points</b></a></li>
              <li><a>Gain like for tweet : <b>15 points</b></a></li>
            </ul>
          </div>
          <h4 class="header">Innovators</h4>
          <table id="users_table" class="table table-striped sortable">
            <thead>
              <tr>
                <th style="cursor: pointer;">Photo</th>
				<th style="cursor: pointer;">Rating</th>
                <th style="cursor: pointer;">Username</th>
                <th style="cursor: pointer;">Name</th>
                <th title="Innovature job position" style="cursor: pointer;">Position</th>
                <th style="cursor: pointer;">Contact</th>
                <th title="Points gained by various activites on innoTweets" style="cursor: pointer;">Point</th>
                <th title="Innovature join date" style="cursor: pointer;">Join Date</th>
              </tr>
            </thead>
            <tbody>
			  <?php $count = 1; ?>
			  <?php if (!empty($users_data)) { ?>
				<?php foreach ($users_data as $user_data) { ?>
				  <tr>
					<td><img style="height: 25px; width: 25px; max-height: 25px; max-width: 25px;" src="<?php echo base_url('assets/photos/' . $user_data['user_image']); ?>"/></td>
					<td>
					  <?php if (!$user_data['user_resigned']) { ?>
						<?php if (($count < 11) && ($offset < 50)) { ?>
						  <i class="icon icon-star"></i><i class="icon icon-star"></i><i class="icon icon-star"></i>
						<?php } else { ?>
						  <?php if (empty($user_data['user_likes_level'])) { ?>
		  				  <i class="icon icon-star"></i>
						  <?php } else { ?>
		  				  <i class="icon icon-star"></i><i class="icon icon-star"></i>
						  <?php } ?>
						<?php } ?>
					  <?php } else { ?> 
	  				  --
					  <?php } ?>
					</td>
					<td>
					  <?php if (!$user_data['user_resigned']) { ?>
						<?php if (is_online($user_data['user_id'])) { ?>
						  <img src="<?php echo site_url('assets/img/online_button_tiny.png'); ?>" title="Online"/>
						<?php } else { ?>
						  <img src="<?php echo site_url('assets/img/offline_button_tiny.png'); ?>" title="Offline"/>
						<?php } ?>
					  <?php } else { ?> 
	  				  <img src="<?php echo site_url('assets/img/resigned_button_tiny.png'); ?>" title="Online"/>
					  <?php } ?>
					  <?php if (check_is_admin($user_data['user_name'])) { ?>
	  				  <a title="Admin" style="text-decoration: none; cursor: pointer;" href="<?php echo base_url('profile/' . $user_data['user_name']); ?>"><b><?php echo '@' . $user_data['user_name']; ?></b></a>
					  <?php } else { ?>
						<?php if ($user_data['user_resigned'] == 1) { ?>
						  <a title="Resigned" style="text-decoration: none; cursor: pointer; color: lightgrey;"><?php echo '@' . $user_data['user_name']; ?></a>
						<?php } else { ?>
						  <a title="User" style="text-decoration: none; cursor: pointer; color: black;" href="<?php echo base_url('profile/' . $user_data['user_name']); ?>"><?php echo '@' . $user_data['user_name']; ?></a>
						<?php } ?>
					  <?php } ?>
					</td>
					<?php if ($user_data['user_resigned'] == 1) { ?>
	  				<td style="color: lightgrey;"><?php echo substr($user_data['user_display_name'], 0, 50); ?></td>
					<?php } else { ?>
	  				<td><?php echo substr($user_data['user_display_name'], 0, 50); ?></td>
					<?php } ?>
					<?php if ($user_data['user_resigned'] == 1) { ?>
	  				<td style="color: lightgrey;"><?php echo substr($user_data['user_position'], 0, 50); ?></td>
	  				<td style="color: lightgrey;"><?php echo $user_data['user_contact_no']; ?></td>
	  				<td style="color: lightgrey;"><?php echo $user_data['user_likes_level']; ?></td>
					<?php } else { ?>
	  				<td><?php echo substr($user_data['user_position'], 0, 50); ?></td>
	  				<td><?php echo $user_data['user_contact_no']; ?></td>
	  				<td>
						<?php $point_change = NULL; ?>
						<?php if ($point_change == 'up') { ?>
						  <i class="icon-arrow-up"></i>&nbsp;
						<?php } elseif ($point_change == 'down') { ?>
						  <i class="icon-arrow-down"></i>&nbsp;
						<?php } else { ?>
						  <?php // <i class="icon-stop"></i>&nbsp; ?>
						<?php } ?>
						<?php echo $user_data['user_likes_level']; ?>
	  				</td>
					<?php } ?>
					<?php if ($user_data['user_resigned'] == 1) { ?>
	  				<td style="color: lightgrey;"><span>--</span></td>
					<?php } else { ?>
	  				<td><span><?php echo date('d-m-Y', strtotime($user_data['user_join_date'])); ?></span></td>
					<?php } ?>
				  </tr>
				  <?php $count++; ?>
				<?php } ?>
			  <?php } ?>
            </tbody>
          </table>
          <div style="float: right;">
			<?php $sep = NULL; ?>
			<?php if ($offset) { ?>
  			<a style="text-decoration: none; color: black;" href="<?php echo base_url('users/' . ($offset - 50)); ?>"><i class="icon-large icon-chevron-left"></i><b>Prev</b></a>
			<?php } ?>
			<?php if (($offset) && (($offset + 50) <= $total_users_count)) { ?>
  			&nbsp;|&nbsp;
			<?php } ?>
			<?php if (($offset + 50) < $total_users_count) { ?>
  			<a style="text-decoration: none; color: black;" href="<?php echo base_url('users/' . ($offset + 50)); ?>"><b>Next</b><i class="icon-large icon-chevron-right"></i></a>
			  <?php } ?>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>